{
  "properties" : { },
  "id" : "ed1d818897ac4ba48aea49997f6f9ba4",
  "script" : null,
  "groupId" : "14f1a21ced0a4e9589c95c58b3b5bb48",
  "name" : "查询地区对应告警次数",
  "createTime" : 1727070963390,
  "updateTime" : 1726731504236,
  "lock" : "1",
  "createBy" : "ndmp",
  "updateBy" : "ndmp",
  "path" : "mapCount",
  "method" : "GET",
  "parameters" : [ {
    "name" : "regionId",
    "value" : "61",
    "description" : null,
    "required" : false,
    "dataType" : "String",
    "type" : null,
    "defaultValue" : null,
    "validateType" : null,
    "error" : null,
    "expression" : null,
    "children" : null
  } ],
  "options" : [ ],
  "requestBody" : "",
  "headers" : [ ],
  "paths" : [ ],
  "responseBody" : "{\n    \"status\": 200,\n    \"message\": \"success\",\n    \"data\": {\n        \"61\": {\n            \"count(*)\": \"0\"\n        },\n        \"{code=6110}\": {\n            \"count(*)\": \"0\"\n        },\n        \"{code=6103}\": {\n            \"count(*)\": \"0\"\n        },\n        \"{code=6104}\": {\n            \"count(*)\": \"0\"\n        },\n        \"{code=6101}\": {\n            \"count(*)\": \"0\"\n        },\n        \"{code=6112}\": {\n            \"count(*)\": \"0\"\n        },\n        \"{code=6102}\": {\n            \"count(*)\": \"0\"\n        },\n        \"sum\": \"0\",\n        \"{code=6107}\": {\n            \"count(*)\": \"0\"\n        },\n        \"{code=6108}\": {\n            \"count(*)\": \"0\"\n        },\n        \"serious\": \"0\",\n        \"{code=6105}\": {\n            \"count(*)\": \"0\"\n        },\n        \"{code=6106}\": {\n            \"count(*)\": \"0\"\n        },\n        \"urgent\": \"0\",\n        \"{code=6109}\": {\n            \"count(*)\": \"0\"\n        }\n    }\n}",
  "description" : "",
  "requestBodyDefinition" : {
    "name" : null,
    "value" : null,
    "description" : null,
    "required" : false,
    "dataType" : "String",
    "type" : null,
    "defaultValue" : null,
    "validateType" : null,
    "error" : null,
    "expression" : null,
    "children" : null
  },
  "responseBodyDefinition" : {
    "name" : null,
    "value" : null,
    "description" : null,
    "required" : false,
    "dataType" : "String",
    "type" : null,
    "defaultValue" : null,
    "validateType" : null,
    "error" : null,
    "expression" : null,
    "children" : null
  }
}
================================
import java.util.concurrent.CountDownLatch;

sql1 = """ SELECT code FROM blade_region WHERE parent_code =#{regionId} """

sql2 = """
    SELECT COUNT(*) FROM alarm_info info
    left join alarm_rule ru on ru.id = info.alarm_rule_id
    left join alarm_level leve on leve.level = ru.level
    WHERE leve.LEVEL < 6 AND info.is_recovery = 0 AND info.ALARM_TARGET in (
        SELECT ndmp_device.ID FROM ndmp_map, ndmp_device
        WHERE ndmp_map.dept_id = ndmp_device.DCC_ID AND region_code IN (
            SELECT code FROM blade_region WHERE INSTR(ancestors, #{regionId}) > 0 or code = #{regionId}
        ))
"""

sql3 = """ 
    SELECT COUNT(*) FROM alarm_info info
    left join alarm_rule ru on ru.id = info.alarm_rule_id
    left join alarm_level leve on leve.level = ru.level
    WHERE leve.LEVEL = 1 AND info.is_recovery = 0 AND info.ALARM_TARGET in (
        SELECT ndmp_device.ID FROM ndmp_map, ndmp_device
        WHERE ndmp_map.dept_id = ndmp_device.DCC_ID AND region_code IN (
            SELECT code FROM blade_region 
            WHERE INSTR(ancestors, #{regionId}) > 0 or code = #{regionId}
        ))
 """
count = db.selectOne(sql2)
HashMap result = new HashMap();
List childList = db.select(sql1)
long time2 = System.currentTimeMillis();
childList.add(regionId);
CountDownLatch countDownLatch = new CountDownLatch(childList.size());
childList.parallelStream().forEach(regionStr ->{
    result.put(regionStr, count);
    countDownLatch.countDown();
});
countDownLatch.await();
long time3 = System.currentTimeMillis();
sum = 0;
for (value in result.values()) {
    sum += value.get("count(*)");
}
int urgent = db.selectOne(sql3).get("count(*)")
long time4 = System.currentTimeMillis();

result.put("sum", sum);
result.put("urgent", urgent);
result.put("serious", sum - urgent);
return result
